import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
export const constantRoutes = [
   {
       path:'/',
       name:'/',
       component:()=>import('@/views/Dashboard')
   },
   {
    path:'/first',
    name:'/first',
    component:()=>import('@/views/Dashboard')
   },
   {
       path:'/template1',
       name:'/template1',
       component:()=>import('@/views/Template1')
   },
   {
    path:'/template2',
    name:'/template2',
    component:()=>import('@/views/Template2')
}
];

const createRouter = () =>
  new Router({
    mode: "history", // require service support
    scrollBehavior: () => ({
      y: 0
    }),
    routes: constantRoutes
  });
const router = createRouter();
export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
}

export default router;
